﻿@model Dictionary<pagingInfoEnum,int>
@using publicLibrary;
@{
    Layout = null;
    List<int> num = new List<int>();
    
    //前3页
    for (int i = 1; i <= 1; i++)
    {
        num.Add(i);
    }
    
    //后3页
    for (int i = 0; i < 1; i++)
    {
        num.Add(Model[pagingInfoEnum.itemCount] - i);
    }
    
    //中间5页
    for (int i = -2; i <= 2; i++)
    {
        num.Add(Model[pagingInfoEnum.pageIndex] + i);        
    }
    
    //去掉超过边界的 排序 去掉重复项 
    var pageNum = num.Where(d => d > 0 && d <= Model[pagingInfoEnum.pageCount]).Distinct().OrderBy(d => d);

    int page = 0;
    
}
<!--总记录数：@Model[pagingInfoEnum.itemCount]-->
<!--<a href="?parameter=@(Model[pagingInfoEnum.pageIndex]-1)">上一页</a>-->
<div class="paging">
@foreach (var i in pageNum)
{
    
    if (page != i-1)
    { 
        <text> ... </text>
    }
    
    if (i == Model[pagingInfoEnum.pageIndex])
    { 
        <a class="hackLine now" href="?parameter=@i">@i</a>
    }
    else
    { 
        <a class="hackLine" href="?parameter=@i">@i</a>
    }



    page = i;
}
</div>
<style>
    .paging{ text-align:right; padding-right:20px; font-size:.9em;}
    .paging a,.paging a:link{ display:inline-block; padding:3px; margin:3px; border:1px solid red;background-color:#e0e0e0; text-decoration:none;}
    .paging a:hover{ color:#fff; background-color:Red !important;}    
    .paging a.now:link,.paging a.now:visited{background-color:#fff !important; }
</style>
<!--<a href="?parameter=@(Model[pagingInfoEnum.pageIndex] + 1)">下一页</a> -->
          
<!--
每页记录数：@Model[pagingInfoEnum.pageSize]
总记录数：@Model[pagingInfoEnum.itemCount]
总页数：@Model[pagingInfoEnum.pageCount]
当前页数：@Model[pagingInfoEnum.pageIndex]
-->